# -*- coding: utf-8 -*-
#
# Author:: JonnyHan
# Date:: 2020/8/18

import os
import re
import sys
from pathlib import Path
from submodules.common.lib.platform_ import is_mac, is_windows
from submodules.common.lib import os_

path = os.path.realpath(__file__)
project_path = os.path.split(os.path.split(os.path.split(os.path.split(path)[0])[0])[0])[0]

project_path_parent = str(Path(project_path).parent)
project_name = str(Path(project_path).name)

project_config_path = os.path.join(project_path, "config")
os_.makedirs_softly(project_config_path)

project_tmp_path = os.path.join(project_path_parent, "%s_tmp" % project_name)
os_.makedirs_softly(project_tmp_path)
project_tmp_log_path = os.path.join(project_tmp_path, "log")
os_.makedirs_softly(project_tmp_log_path)
project_tmp_images_path = os.path.join(project_tmp_path, "tmp_images")
os_.makedirs_softly(project_tmp_images_path)
project_tmp_monitor_images_path = os.path.join(project_tmp_path, "monitor_images")
os_.makedirs_softly(project_tmp_monitor_images_path)
project_tmp_monitor_images_path = os.path.join(project_tmp_path, "data")
os_.makedirs_softly(project_tmp_monitor_images_path)





def get_chromedriver_path():
    if is_mac():
        chromedriver_path = os.path.join(project_path, "drivers", "mac", "chromedriver", get_local_chrome_version(),
                                         "chromedriver")
    elif is_windows():
        pass
    return chromedriver_path


def get_test_data_path():
    current_path = Path(sys.argv[0])
    project_test_data_path = os.path.join(project_path, "test", "data", current_path.with_suffix("").name)
    return project_test_data_path


if __name__ == '__main__':
    print(project_path)
